package com.pms.mapper;

import com.pms.pojo.WorkAttendance;
import com.pms.pojo.statistics.*;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;
import java.util.Map;

@Mapper
public interface WorkAttendanceMapper {

    List<WorkAttendance> list(@Param("userName") String userName,
                              @Param("operateType") Integer operateType,
                              @Param("startTime") Date startTime,
                              @Param("endTime") Date endTime);

    WorkAttendance getById(@Param("id") Long id);

    void update(WorkAttendance workAttendance);

    void delete(@Param("id") Long id);

    void insert(WorkAttendance workAttendance);

    /**
     * 根据用户id查询出所有考勤记录
     * @param userId
     * @return
     */
    List<WorkAttendance> getByUserId(@Param("userId") Long userId);

    // 统计部门员工数
    Integer countEmployeesByDept(Long deptId);

    // 统计总员工数
    Integer countTotalEmployees();

    /**
     * 获取考勤统计数据
     * @param query 查询条件
     * @return 统计结果
     */
    AttendanceStatisticsData getAttendanceData(AttendanceStatisticsQuery query);

    // 获取每日考勤统计
    List<DailyAttendance> getDailyAttendanceStats(AttendanceStatisticsQuery query);

    // 获取部门考勤统计
    List<DepartmentAttendance> getDepartmentAttendanceStats(AttendanceStatisticsQuery query);

    // 获取考勤详细记录
    List<AttendanceRecord> getAttendanceRecords(AttendanceStatisticsQuery query);
}